# Load CUDA using the following command
# module load cuda

#
# Dirac
#
CC = nvcc
MPCC = nvcc
CFLAGS = -O3 -arch sm_20
NVCCFLAGS = -O3 -arch sm_20
#CFLAGS = -g -G -arch sm_20
#NVCCFLAGS = -g -G  -arch sm_20 
LIBS = -lm

TARGETS = serial gpu2 gpu es-bvs-bl-gpu

all:	$(TARGETS)

serial: serial.o common.o
	$(CC) -o $@ $(LIBS) serial.o common.o
gpu: gpu.o es-bvs-bl-common.o
	$(CC) -o $@ $(NVCCLIBS) gpu.o es-bvs-bl-common.o
es-bvs-bl-gpu: es-bvs-bl-gpu.o es-bvs-bl-common.o
	$(CC) -o $@ $(NVCCLIBS) es-bvs-bl-gpu.o es-bvs-bl-common.o
gpu2: gpu2.o es-bvs-bl-common.o
	$(CC) -o $@ $(NVCCLIBS) gpu2.o es-bvs-bl-common.o

serial.o: serial.cu common.h
	$(CC) -c $(CFLAGS) serial.cu
gpu.o: gpu.cu es-bvs-bl-common.h
	$(CC) -c $(NVCCFLAGS) gpu.cu
es-bvs-bl-gpu.o: es-bvs-bl-gpu.cu es-bvs-bl-common.h
	$(CC) -c $(NVCCFLAGS) es-bvs-bl-gpu.cu
gpu2.o: gpu2.cu es-bvs-bl-common.h
	$(CC) -c $(NVCCFLAGS) gpu2.cu
common.o: common.cu common.h
	$(CC) -c $(CFLAGS) common.cu
es-bvs-bl-common.o: es-bvs-bl-common.cu es-bvs-bl-common.h
	$(CC) -c $(CFLAGS) es-bvs-bl-common.cu

clean:
	rm -f *.o $(TARGETS)
